package cn.jinjimi.app.controller.event.NoticeEvent;

import cn.jinjimi.app.store.entity.NoticeEntity;

import org.greenrobot.eventbus.EventBus;

import java.util.List;

/**
 * Created by Roy
 * Date: 16/12/13
 */

public class NoticeEvent {
    public static final int StateAdd = 1;
    public static final int StateDel = 2;

    public int state;
    public int count;

    public NoticeEvent(int state) {
        this.state = state;
    }

    public NoticeEvent(List<NoticeEntity> noticeEntities) {
        this.state = NoticeEvent.StateAdd;
        this.count = noticeEntities.size();
    }

    public static void dispatchNotice(List<NoticeEntity> noticeEntities, String code) {
        switch (code) {
            case NoticeEntity.TypeNewVersion:
                EventBus.getDefault().post(new NoticeNewVersionEvent(noticeEntities));
                break;
            case NoticeEntity.TypeNewFeature:
                EventBus.getDefault().post(new NoticeNewFeatureEvent(noticeEntities));
                break;
            case NoticeEntity.TypeBigDay:
                EventBus.getDefault().post(new NoticeBigDayEvent(noticeEntities));
                break;
            case NoticeEntity.TypeNewClue:
                EventBus.getDefault().post(new NoticeNewClueEvent(noticeEntities));
                break;
            case NoticeEntity.TypeDrpEvent:
                EventBus.getDefault().post(new NoticeDrpEvent(noticeEntities));
                break;
            case NoticeEntity.TypeNewPoster:
                EventBus.getDefault().post(new NoticeNewPosterEvent(noticeEntities));
                break;
            case NoticeEntity.TypeAlert:
                EventBus.getDefault().post(new NoticeAlertEvent(noticeEntities));
                break;
            case NoticeEntity.TypeNewJinju:
                EventBus.getDefault().post(new NoticeNewJinjuEvent(noticeEntities));
                break;
            case NoticeEntity.TypeNewArticle:
                EventBus.getDefault().post(new NoticeNewAritcleEvent(noticeEntities));
                break;
            case NoticeEntity.TypeRewardCard:
                EventBus.getDefault().post(new NoticeRewardCardEvent(noticeEntities));
                break;
        }
    }

    public static void dispatchClickNotice(String code) {
        switch (code) {
            case NoticeEntity.TypeNewVersion:
                EventBus.getDefault().post(new NoticeNewVersionEvent(StateDel));
                break;
            case NoticeEntity.TypeNewFeature:
                EventBus.getDefault().post(new NoticeNewFeatureEvent(StateDel));
                break;
            case NoticeEntity.TypeBigDay:
                EventBus.getDefault().post(new NoticeBigDayEvent(StateDel));
                break;
            case NoticeEntity.TypeNewClue:
                EventBus.getDefault().post(new NoticeNewClueEvent(StateDel));
                break;
            case NoticeEntity.TypeDrpEvent:
                EventBus.getDefault().post(new NoticeDrpEvent(StateDel));
                break;
            case NoticeEntity.TypeNewPoster:
                EventBus.getDefault().post(new NoticeNewPosterEvent(StateDel));
                break;
            case NoticeEntity.TypeAlert:
                EventBus.getDefault().post(new NoticeAlertEvent(StateDel));
                break;
            case NoticeEntity.TypeNewJinju:
                EventBus.getDefault().post(new NoticeNewJinjuEvent(StateDel));
                break;
            case NoticeEntity.TypeNewArticle:
                EventBus.getDefault().post(new NoticeNewAritcleEvent(StateDel));
                break;
            case NoticeEntity.TypeRewardCard:
                EventBus.getDefault().post(new NoticeRewardCardEvent(StateDel));
                break;
        }
    }

}
